<template>
	<view>
		<view class="newsBox">
			<view class="pic">
				<image :src="item.picurl" mode="aspectFill"></image>
			</view>
			<view class="text">
				<view class="title">
					{{item.title}}
				</view>
				<view class="info" v-if="!item.looktime">
					<text class="author">{{item.author}}</text>
					<text class="number">{{item.hits}}阅读</text>
				</view>
				<view class="info2" v-else>
					<text class="time">浏览时间{{item.looktime}}</text>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		name: "newsBox",
		props: {
			item: {
				type: Object,
				default(){
					return {
						title:'默认title',
						author:'默认名',
						hits:666,
						picurl:'',
						looktime:''
					}
				}
			},
			// newsArr: {
			// 	type: Array
			// }
		},
		data() {
			return {
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.newsBox {
		border-bottom: 1px solid #999;
		padding: 15rpx 0;
		display: flex;

		.pic {
			image {
				width: 230rpx;
				height: 160rpx;
			}
		}

		.text {
			flex: 1;
			// background-color: pink;
			margin-left: 40rpx;
			display: flex;
			// 竖向排列
			flex-direction: column;
			//  竖向两边排列
			justify-content: space-between;
			.title {
				// 一行省略号
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				// background-color: skyblue;
				font-size: 38rpx;
			}

			.info {

				display: flex;
				align-items: end;
				
				.author {
					line-height: 30rpx;
					font-size: 28rpx;
					flex: 2;
				}

				.number {
					line-height: 30rpx;
					font-size: 28rpx;
					flex: 1;
				}
			}

		}
	}
</style>
